import { getLevelFirst, getLevelZero, getUserID } from '@/utils';

const ManageTabSwitch = (curRes: Record<string, any>) => {
  /**
   * 权限判断方法
   * */
  if (curRes?.['/purchaseReportController/companyID']) {
    return {
      companyID: getLevelZero(),
      params: 'companyID',
      // key: 'key1',
    };
  } else if (curRes?.['/purchaseReportController/departmentID']) {
    return {
      departmentID: getLevelFirst(),
      params: 'departmentID',
      // key: 'key1',
    };
  } else if (curRes?.['/purchaseReportController/userID']) {
    return {
      userID: getUserID(),
      params: 'userID',
      // key: 'key1',
    };
  } else {
    return {};
  }
};

/**
 * 供应商权限
 * */
const supplierManageTabSwitch = (curRes: Record<string, any>) => {
  if (curRes?.['/supplierInfoController/createCompanyID']) {
    return {
      createCompanyID: getLevelZero(),
      params: 'createCompanyID',
    };
  } else if (curRes?.['/supplierInfoController/createDepartmentID']) {
    return {
      createDepartmentID: getLevelFirst(),
      params: 'createDepartmentID',
    };
  }
  return {};
};

export { ManageTabSwitch, supplierManageTabSwitch };
